<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:87:"/Users/yandian/work/matian/application/admin/view/bootstrap/codeTool/formForWeixin.html";i:1491795404;}*/ ?>
{extend name="public/layout"}
{block name="head"}
{:_css('static/css/weui.css')}
{:_css('css/weui2.css')}
{/block}
{block name="title"}在线预约{/block}
{block name="content"}

<div class="form mt10" id="form1">
    <?php if(is_array($formFields)): $i = 0; $__LIST__ = $formFields;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;if($vo['field'] != 'id' && $vo['field'] != 'member_id' && $vo['field'] != 'create_time'): ?>
    <div class="flex border-b">
        <label for="<?php echo $vo['field']; ?>"><?php echo $vo['title']; ?></label>
        <div class="flex-con">
            <input type="text" autocomplete="off" class="form-control" name="<?php echo $vo['field']; ?>" id="<?php echo $vo['field']; ?>" placeholder="请输入<?php echo $vo['title']; ?>">
        </div>
    </div>
    <?php endif; endforeach; endif; else: echo "" ;endif; ?>
</div>

<div class="btn-area">
    <div id="submitBtn" class="bg-primary btn-block btn">保存提交</div>
</div>

{:_js('static/layermobile/layer.js')}
{:_js('js/phone.js')}
{:_js('static/js/zepto.min.js')}
{:_js('static/js/weui.js')}
{:_js('js/picker.js')}


<script>
    $(function () {
        $('#submitBtn').on('click', function () {
            var postData = {};
            var is_valid = true;
            $('#form1').find('input[name],textarea[name]').each(function () {
                if(!this.value.trim() && this.name != 'address'){
                    is_valid = false;
                    ui.msg($(this).attr('placeholder'));
                    return false;
                }
                postData[this.name] = this.value.trim();
            });
            if(is_valid){
                ui.toast.show();
                $.post("{:U('save')}",postData, function (rt) {
                    ui.toast.hide();
                    if(rt.status==1){
                        location.href = "{:U('saveResult')}";
                    }else{
                        ui.msg(rt.info);
                    }
                },'json');
            }
        });
    });
</script>

{/block}
